package com.rmt.www.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.rmt.www.dao.ProjectDao;
import com.rmt.www.dao.UserDao;
import com.rmt.www.service.AdminManageProjectService;
import com.rmt.www.vo.Project;
import com.rmt.www.vo.User;


public class AddProjectAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String title;
	private String description;
	private AdminManageProjectService adminManageProjectService;
	
	public AdminManageProjectService getAdminManageProjectService() {
		return adminManageProjectService;
	}
	public void setAdminManageProjectService(
			AdminManageProjectService adminManageProjectService) {
		this.adminManageProjectService = adminManageProjectService;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	
	public String execute(){
		Project p=new Project();
		p.setTitle(title);
		p.setDescription(description);
		User u=(User)ActionContext.getContext().getSession().get("currentUser");
		p.setCreatorId(u.getUid());
		adminManageProjectService.addNewProject(p);
		return "success";
	}
}
